<template>
  <div class="app-container">
    <el-form ref="form" :model="form" label-width="120px">
      <el-row>
        <el-divider content-position="left">维修设备</el-divider>
        <el-descriptions direction="vertical" :column="6" border>
          <el-descriptions-item label="项目区域"><dict-tag :options="dict.type.cld_project_region"
              :value="form.projectRegion" /></el-descriptions-item>
          <el-descriptions-item label="项目名称">{{ form.projectName }}</el-descriptions-item>
          <el-descriptions-item label="资产名称">{{ form.assetsName }}</el-descriptions-item>
          <el-descriptions-item label="资产类型"><dict-tag :options="dict.type.cld_assets_type"
              :value="form.assetsType" /></el-descriptions-item>
          <el-descriptions-item label="资产型号">{{ form.assetsModel }}</el-descriptions-item>
          <el-descriptions-item label="设备ID">{{ form.assetsIdCard }}</el-descriptions-item>
        </el-descriptions>
      </el-row>
      <el-row :gutter="20" style="margin-top: 20px;">
        <el-col :span="12">
          <el-form-item label="报修描述：" prop="reportDesc">
            {{ form.reportDesc }}
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="相关图片：">
            <image-preview style="margin-right: 10px;" :key="item" v-for="item in form.reportImgsList" :src="item"
              :width="100" :height="100" /></el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="16">
          <el-divider content-position="left">维修信息</el-divider>
          <el-row :gutter="10">
            <el-col :span="8">
              <el-form-item label="维修人：" prop="repairUserName">
                {{ form.repairUserName }}
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="损坏状态" prop="repairStatus">
                <dict-tag :options="repairStatusOptions" :value="parseInt(form.repairStatus)" />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="其他金额" prop="repairMoney">
                {{ toMoney(form.repairMoney) }}
              </el-form-item>
            </el-col>
          </el-row>
        </el-col>
      </el-row>
      <el-row>
        <el-divider content-position="left">维修配件</el-divider>
        <el-table :data="form.detailsList" border>
          <el-table-column label="商品编号" align="center" prop="commodityNo" />
          <el-table-column label="商品名称" align="center" prop="commodityName1" />
          <el-table-column label="数量" align="center" prop="assetsRepairNumber" />
          <el-table-column label="单位" align="center" prop="unitName1" />
          <el-table-column label="规格" align="center" prop="commoditySpec" />
          <el-table-column label="成本单价" align="center" prop="costPrice">
            <template slot-scope="scope">
              {{ toMoney(scope.row.costPrice) }}
            </template>
          </el-table-column>
          <el-table-column label="成本总价" align="center" prop="costPrice">
            <template slot-scope="scope">
              {{ toMoney(scope.row.assetsRepairNumber * scope.row.costPrice) }}
            </template>
          </el-table-column>
        </el-table>
      </el-row>
      <el-row :gutter="20" style="margin-top: 20px;">
        <el-col :span="12">
          <el-form-item label="维修描述" prop="repairDesc">
            {{ form.repairDesc }}
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="相关图片" prop="repairImgs">
            <image-preview style="margin-right: 10px;" :key="item" v-for="item in form.repairImgsList" :src="item"
              :width="100" :height="100" />
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>

<script>
import { repairStatusOptions } from '@/assets/staticDict'
export default {
  name: "repair",
  dicts: ['cld_assets_type'],
  props: {
    form: {
      type: Object
    }
  },
  data() {
    return {
      repairStatusOptions: repairStatusOptions
    };
  },
  created() {
  },
  methods: {
    handleConfirmRepairSubmit() {
      addPlacementRecord(this.form).then(res => {
        this.$modal.msgSuccess("操作成功");
      })
    },
  }
};
</script>
<style scoped>
.el-range-editor.el-input__inner {
  width: 100%;
}
</style>
